package com.xbongbong.paas.enums;

import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.base.CommunicateBaseEnum;
import com.xbongbong.saas.enums.business.ClueEnum;
import com.xbongbong.saas.enums.base.CommunicateBaseEnum;
import com.xbongbong.saas.enums.business.CommunicatePlanEnum;
import com.xbongbong.saas.enums.business.CustomerCommunicateEnum;
import com.xbongbong.saas.enums.business.CustomerManagementEnum;
import com.xbongbong.saas.enums.business.ProductEnum;
import com.xbongbong.saas.enums.business.WorkReportDailyEnum;
import com.xbongbong.saas.enums.business.WorkReportMonthlyEnum;
import com.xbongbong.saas.enums.business.WorkReportWeeklyEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

@Getter
public enum OuterLinkShareRemoveAttrEnum {

    CUSTOMER_COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), Arrays.asList(CustomerCommunicateEnum.COMMUNICATE_BUSINESS.getAttr(), CustomerCommunicateEnum.NEXT_COMMUNICATE_TIME.getAttr(), CustomerCommunicateEnum.NOTIFY_TYPE.getAttr(), CustomerCommunicateEnum.NEXT_NOTIFY_MEMO.getAttr())),
    SUPPLIER_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), Arrays.asList(CommunicateBaseEnum.COMMUNICATE_BUSINESS.getAttr())),
    COMMUNICATE_PLAN(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), Arrays.asList(CommunicatePlanEnum.EXECUTOR.getAttr(), CommunicatePlanEnum.CONTACT_WAY.getAttr())),
    PRODUCT(XbbRefTypeEnum.PRODUCT.getCode(), Arrays.asList(ProductEnum.STOCK_NOTIFY.getAttr())),
    WORKREPORT_DAILY(XbbRefTypeEnum.WORKREPORT_DAILY.getCode(), Arrays.asList(WorkReportDailyEnum.THIS_STATISTIC.getAttr(), WorkReportDailyEnum.REVIEWER.getAttr(), WorkReportDailyEnum.IS_RESSUE.getAttr())),
    WORKREPORT_WEEKLY(XbbRefTypeEnum.WORKREPORT_WEEKLY.getCode(), Arrays.asList(WorkReportWeeklyEnum.THIS_STATISTIC.getAttr(), WorkReportWeeklyEnum.REVIEWER.getAttr(), WorkReportWeeklyEnum.IS_RESSUE.getAttr())),
    WORKREPORT_MONTHLY(XbbRefTypeEnum.WORKREPORT_MONTHLY.getCode(), Arrays.asList(WorkReportMonthlyEnum.THIS_STATISTIC.getAttr(), WorkReportMonthlyEnum.REVIEWER.getAttr(), WorkReportMonthlyEnum.IS_RESSUE.getAttr())),
    CUSTOMER(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), Arrays.asList(CustomerManagementEnum.SCORE.getAttr())),
    CLUE(XbbRefTypeEnum.CLUE.getCode(), Arrays.asList(ClueEnum.SCORE.getAttr())),
    ;

    /**
     * 业务类型
     */
    private Integer businessType;
    /**
     * 不支持的字段
     */
    private List<String> fieldAttrs;



    OuterLinkShareRemoveAttrEnum(Integer businessType, List<String> fieldAttrs) {
        this.businessType = businessType;
        this.fieldAttrs = fieldAttrs;
    }

    public static List<String> getAttrList(Integer type) {
        for (OuterLinkShareRemoveAttrEnum e : values()) {
            if (Objects.equals(type, e.getBusinessType())) {
                return e.getFieldAttrs();
            }
        }
        return new ArrayList<>();
    }
}
